import "pkl:test"

const function matches(pattern: String): (String) -> Boolean = (str) -> str.matches(Regex(pattern))

class X {
  a: String(length >= 5, matches("\\w+\\.\\w+")) = "one.two"
}

res1 = new X {}

res2 = new X {
  a = "five.six"
}

res3 = test.catch(() ->
  new X {
    a = "n.o"
  }.a
)
